-- background: 10332 from stack: in.1 -- bmap block id: 10500 -- flags: 4000 -- background id: 0 -- name: Mini HyperStation ----- HyperTalk script ----- --•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• --Hyperstation™ background script --©1987 Steve Drazga --•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• --•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• --system messages --•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• --•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• -- on OsErr err -- Translate the most common ones if err > 0 then -- XFCN convention put "Parameter error with function" into errstr else if err is -59 then put "Problem during rename" into errstr else if err is -54 then put "Attempt to open locked file for writing" into errstr else if err is -46 then put "Volume locked by software" into errstr else if err is -45 then put "File locked" into errstr else if err is -44 then put "Volume locked by hardware" into errstr else if err is -43 then put "File not found" into errstr else if err is -37 then put "Bad volume or file name" into errstr else if err is -36 then put "I/O error" into errstr else if err is -35 then put "No such volume" into errstr else if err is -34 then put "Disk is full" into errstr else if err is -49 then put "File already open for writing" into errstr else put "Failed with error" && err into errstr end if answer errstr with "OK" end OsErr -- --•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• --•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• --messages from application buttons --•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• --•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• -- on NoApp -- --Original script by Steve Drazga, ART Incorpoated --XFCNs used: none --XCMDs used: popUpMenu --HANDLERS used: InsertApp,InsertStack,InsertDoc,InsertDA --FUNCTIONS used: none -- global LaunchButton put id of target into LaunchButton put the mouseloc into myPlace put item 1 of myPlace - 20 into horiz put item 2 of myPlace - 10 into vert put PopUpMenu("Application;Stack;Document;Desk Accessory",1,vert,horiz) into MenuResult set hilite of target to false if MenuResult is 0 then exit NoApp else if MenuResult is 1 then InsertApp else if MenuResult is 2 then InsertStack else if MenuResult is 3 then InsertDoc else if MenuResult is 4 then InsertDA end NoApp -- --•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• -- on ChangeApp -- --Original script by Steve Drazga, ART Incorpoated --XFCNs used: none --XCMDs used: KillResID, --HANDLERS used: InsertApp, --FUNCTIONS used: MenuItemSelected,RemoveTarget,RenameTarget, -- DeleteTarget,MoveTarget, -- global LaunchButton put (id of target)+3 into LaunchButton --••This is the launcherButton if (the short name of button id LaunchButton) is "Install..." then InsertApp else put MenuItemSelected("ChangeApp") into PopUpSelected if PopUpSelected=0 then exit ChangeApp else if PopUpSelected =1 then InsertApp else if PopUpSelected=2 then put RemoveTarget(LaunchButton) into it put first item of it into stackName put second item of it into iconNum killResID stackName,"ICON",iconNum else if PopUpSelected=3 then put RenameTarget(LaunchButton) into it else if PopUpSelected=4 then put DeleteTarget(LaunchButton) into it else if PopUpSelected=4 then put MoveTarget(LaunchButton) into it end if end ChangeApp -- --•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• -- on InsertApp -- --Original script by Steve Drazga, ART Incorpoated --XFCNs used: none --XCMDs used: none --HANDLERS used: none --FUNCTIONS used: GetApplication,ConvertName,NewTarget, -- global LaunchButton set hilite of target to false put GetApplication() into LongName if LongName is empty then exit InsertApp put ConvertName(LongName) into shortName if shortname contains "HyperCard" then play oops answer "Use 'install stacks' for this" exit insertApp end if put NewTarget(LaunchButton,LongName," ",shortName,"LaunchApp") into it set visible of button id (LaunchButton-3) to true end InsertApp -- --•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• -- on launchApp -- --Original script by Steve Drazga, ART Incorpoated --XFCNs used: multiFinder,isRunning,subLaunch, --XCMDs used: none --HANDLERS used: osErr, --FUNCTIONS used: none -- set cursor to 4 global longname set hilite of target to false if multifinder() is true then if isRunning(short name of the target) is true then beep answer "This application is already running!" else put sublaunch (longname) into launchResult if launchResult <0 then osErr launchResult else if launchresult >0 then beep end if else open longname end if end launchApp -- --•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• -- on ChangeDoc -- --Original script by Steve Drazga, ART Incorpoated --XFCNs used: none --XCMDs used: none --HANDLERS used: InsertDoc, --FUNCTIONS used: MenuItemSelected,RemoveTarget,RenameTarget, -- DeleteTarget,MoveTarget -- global LaunchButton put (id of target)+2 into LaunchButton --••This is the launcherButton if (the short name of button id LaunchButton) is "Install..." then InsertDoc else put MenuItemSelected("ChangeDoc") into PopUpSelected if PopUpSelected=0 then exit ChangeDoc else if PopUpSelected=1 then put RemoveTarget(LaunchButton) into it else if PopUpSelected=2 then put RenameTarget(LaunchButton) into it else if PopUpSelected=3 then put DeleteTarget(LaunchButton) into it else if PopUpSelected=4 then put MoveTarget(LaunchButton) into it end if end ChangeDoc -- --•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• -- on InsertDoc -- --Original script by Steve Drazga, ART Incorpoated --XFCNs used: fileName, --XCMDs used: none --HANDLERS used: NewTarget --FUNCTIONS used: GetApplication,ConvertName -- global LaunchButton set hilite of target to false put GetApplication() into appName if appName is empty then exit InsertDoc put "Please select a document created by that application..." put filename() into docName hide message if docName is empty then exit Insertdoc put ConvertName(docName) into shortName put NewTarget(LaunchButton,appName,docName,shortName,"LaunchDoc") into it set visible of button id (LaunchButton-2) to true end InsertDoc -- --•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• -- on LaunchDoc -- --Original script by Steve Drazga, ART Incorpoated --XFCNs used: mulitFinder,isRunning,subLaunch, --XCMDs used: none --HANDLERS used: none --FUNCTIONS used: ConvertName, -- set cursor to 4 global LongName set hilite of target to false put Convertname(longName) into appName put second item of longName into appPath put first item of longName into docPath if multifinder() is true then if isRunning(appName) is true then beep answer "Please switch to the application to open this" else put sublaunch(appPath,docPath) into LaunchResult if launchResult <0 then osErr launchResult else if launchresult >0 then beep end if else open docPath with appPath end if end LaunchDoc -- --•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• -- on InsertDA play boing answer "Did you register for the full version?" with "Uh oh" end InsertDA -- --•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• -- on LaunchDA play boing put "Sorry I haven't finished the DA launching yet!" end LaunchDA -- --•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• -- on InsertStack -- --Original script by Steve Drazga, ART Incorpoated --XFCNs used: fileName, --XCMDs used: none --HANDLERS used: none --FUNCTIONS used: ConvertName,NewTarget, -- global LaunchButton set hilite of target to false put "Please select a stack..." put fileName("STAK") into stackName hide message if stackName is empty then exit InsertStack put ConvertName(stackName) into shortName put "" into LongName put NewTarget(LaunchButton,LongName,stackName,shortName,"LaunchStack") into it set visible of button id (LaunchButton-2) to true end InsertStack -- --•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• -- on LaunchStack global longName set hilite of target to false push this card go to longName end LaunchStack -- --•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• --•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• --functions --•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• --•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• -- function GetApplication -- --Original script by Steve Drazga, ART Incorpoated --XFCNs used: fileName -- put "Please select an application..." put fileName("APPL") into selectedThis hide message return selectedThis end GetApplication --•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• function ConvertName LongName set cursor to 4 put the length of LongName into nameLength repeat with x = nameLength down to 1 if char x of LongName = ":" then exit repeat end repeat return char (x + 1) to nameLength of LongName end ConvertName --•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• function DeleteLastPart LongName put the length of LongName into nameLength repeat with x = nameLength down to 1 if char x of LongName = ":" then exit repeat delete char x of LongName end repeat return LongName end DeleteLastPart --•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• function StackPath put long name of this stack into stackName delete first word of stackName delete first char of stackName delete last char of stackName return stackName end StackPath --•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• function MenuItemSelected ButtonType -- --Original script by Steve Drazga, ART Incorpoated --XFCNs used: popUpMenu -- global MyPlace put item 1 of myPlace - 20 into horiz put item 2 of myPlace - 10 into vert if ButtonType is "ChangeApp" then get PopUpMenu("Change;Remove;Rename;Delete;Move",1,vert,horiz) else get PopUpMenu("Remove;Rename;Delete;Move",1,vert,horiz) end if set hilite of target to false return it end MenuItemSelected --•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• function RemoveTarget LaunchButton -- --Original script by Steve Drazga, ART Incorpoated -- set cursor to 4 global InstallScript put icon of button id LaunchButton into iconNum put stackPath() into stackName put rect of button id LaunchButton into OrigRect subtract 25 from fourth item of OrigRect set lockscreen to true set name of button id LaunchButton to "Install..." set icon of button id LaunchButton to 0 set rect of button id LaunchButton to OrigRect set style of button id LaunchButton to shadow set visible of button id (LaunchButton-1) to false set visible of button id (LaunchButton-2) to false set visible of button id (LaunchButton-3) to false set lockscreen to false set the script of button id LaunchButton to InstallScript put stackName&","&iconNum into it return it end RemoveTarget --•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• function NewTarget LaunchButton,LongName,docName,shortName,LaunchType -- --Original script by Steve Drazga, ART Incorpoated --XFCNs used: GetAppIcon,GetDocIcon, --XCMDs used: KillResID, --HANDLERS used: none --FUNCTIONS used: none -- set cursor to 4 global LaunchScript put LaunchScript into it delete word 2 of line 4 of it if LaunchType is "LaunchApp" then put ""&"e&LongName"e after word 1 of line 4 of it else if LaunchType is "LaunchStack" then put ""&"e&docName"e after word 1 of line 4 of it else if LaunchType is "LaunchDoc" then put ""&"e&docName&","&LongName"e after word 1 of line 4 of it --handle DA name here delete fifth line of it put return&LaunchType after fourth line of it set the script of button id LaunchButton to it put stackpath() into stackName if icon of button id LaunchButton is not 0 then put icon of button id LaunchButton into IconToDelete killResID stackName,"ICON",IconToDelete end if if LaunchType is "LaunchApp" then put GetAppIcon(LongName,shortName,stackName) into IconToAdd else if LaunchType is "LaunchDoc" then put GetDocIcon (LongName,docName,stackName) into IconToAdd else if LaunchType is "LaunchStack" then put 1000 into IconToAdd else if LaunchType is "LaunchDA" then put --da icon in button UpdateResFork put rect of button id LaunchButton into OrigRect if ((fourth item of OrigRect)-(second item of OrigRect))<25 then add 25 to fourth item of OrigRect set lockscreen to true set rect of button id LaunchButton to OrigRect set icon of button id LaunchButton to IconToAdd set the name of button id LaunchButton to shortName set style of button id LaunchButton to transparent end NewTarget --•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• function RenameTarget LaunchButton -- --Original script by Steve Drazga, ART Incorpoated --XFCNs used: RenameFile, --XCMDs used: none --HANDLERS used: osErr --FUNCTIONS used: deleteLastPart, -- put script of button id LaunchButton into ScriptHolder put second word of fourth line of ScriptHolder into OrigName if second item of OrigName is not empty then put first item of OrigName into OldName put second item of OrigName into AppName else put OrigName into OldName delete last char of OldName end if delete first char of OldName ask "What do you want to name this?" with (short name of button id LaunchButton) if it is empty or it is (short name of button id LaunchButton) then exit RenameTarget else put the length of it into nameLength if nameLength >30 then answer "Name is too long (more than 30 characters)" exit RenameTarget end if put it into NewName put RenameFile (OldName,NewName) into RenameResult if RenameResult = 0 then put deleteLastPart(OldName)&NewName into ReplacementName delete second word of fourth line of ScriptHolder if second item of OrigName is not empty then put space"e&ReplacementName&","&AppName after first word of fourth Line of ScriptHolder else put space"e&ReplacementName"e after first word of fourth Line of ScriptHolder end if set script of button id LaunchButton to ScriptHolder set the name of button id LaunchButton to NewName else if RenameResult<0 then osErr(RenameResult) else answer "Failed to Rename File" end if end if end RenameTarget --•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• function DeleteTarget LaunchButton -- --Original script by Steve Drazga, ART Incorpoated --XFCNs used: DeleteFile, --XCMDs used: none --HANDLERS used: osErr, --FUNCTIONS used: RemoveTarget, -- put second word of fourth line of script of button id LaunchButton into OrigName if second item of OrigName is not empty then put First item of OrigName into OrigName else delete last char of OrigName end if delete first char of OrigName put the short name of button id LaunchButton answer "Are you sure you want to delete the file named below?" with "Cancel" or "Ok" hide message if it is "Cancel" then exit DeleteTarget put DeleteFile (OrigName) into DeleteResult if DeleteResult is 0 then put RemoveTarget(LaunchButton) into it else if DeleteResult<0 then osErr(DeleteResult) else answer "Problem deleting file" end if end DeleteTarget --•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• function MoveTarget LaunchButton set cursor to 4 play boing answer "If you had registered for the program..." end MoveTarget --•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• function moveButton newLocation,OrigLoc,OrigRect -- --Original script by Steve Drazga, ART Incorpoated --XFCNs used: none --XCMDs used: none --HANDLERS used: none --FUNCTIONS used: none -- set userlevel to 5 put first item of newLocation into h put second item of newLocation into v if h>=2 and h<=128 then put 1 into column else if h>=129 and h<=255 then put 6 into column else if h>=256 and h<=382 then put 11 into column else if h>=383 and h<=509 then put 16 into column else put 0 into column if v>=7 and v<=58 then put 1 into row else if v>=59 and v<=110 then put 2 into row else if v>=111 and v<=162 then put 3 into row else if v>=163 and v<=214 then put 4 into row else if v>=215 and v<=266 then put 5 into row else put 0 into row if row≠0 and column≠0 then set cursor to 4 put ((column-1)+row)*4 into ButtonToReplace --save all info about moved button put icon of target into OrigIcon put short name of target into OrigName put style of target into OrigStyle put script of target into OrigScript put id of target into OrigID if visible of button id (OrigID-1) is true then put -1 into OrigType set visible of button id (OrigID-1) to false else if visible of button id (OrigID-2) is true then put -2 into OrigType set visible of button id (OrigID-2) to false else if visible of button id (OrigID-3) is true then put -3 into OrigType set visible of button id (OrigID-3) to false end if --convert moved button into other button set lockscreen to true set loc of target to OrigLoc set icon of target to icon of button id ButtonToReplace set name of target to short name of button id ButtonToReplace set style of target to style of button id ButtonToReplace set script of target to script of button id ButtonToReplace if short name of button id ButtonToReplace is "Install..." then subtract 25 from fourth item of OrigRect end if set rect of target to OrigRect set lockscreen to false if visible of button id (ButtonToReplace-1) is true then set visible of button id (ButtonToReplace-1) to false set visible of button id (OrigID-1) to true else if visible of button id (ButtonToReplace-2) is true then set visible of button id (ButtonToReplace-2) to false set visible of button id (OrigID-2) to true else if visible of button id (ButtonToReplace-3) is true then set visible of button id (ButtonToReplace-3) to false set visible of button id (OrigID-3) to true end if --convert other button into moved button set lockscreen to true set icon of button id ButtonToReplace to OrigIcon set style of button id ButtonToReplace to OrigStyle put rect of button id ButtonToReplace into it if short name of button id ButtonToReplace is "Install..." then add 25 to fourth item of it set rect of button id ButtonToReplace to it end if set name of button id ButtonToReplace to OrigName set lockscreen to false set script of button id ButtonToReplace to OrigScript set visible of button id (ButtonToReplace+OrigType) to true return "Ok" else return "no good" end if end moveButton --•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• -- part 115 (button) -- low flags: 00 -- high flags: 2000 -- rect: left=3 top=310 right=342 bottom=46 -- title width / last selected line: 0 -- icon id / first selected line: 2162 / 2162 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: New Button ----- HyperTalk script ----- on mouseUp visual dissolve to gray visual dissolve to inverse visual dissolve go back end mouseUp -- part 122 (field) -- low flags: 81 -- high flags: 0000 -- rect: left=158 top=313 right=332 bottom=199 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 3 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Relative Card Number -- part 124 (button) -- low flags: 80 -- high flags: A002 -- rect: left=159 top=317 right=334 bottom=210 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Master